package com.menghanjun.mhjresourcesharing.service.impl;

import com.menghanjun.mhjresourcesharing.service.IMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class MailServiceImpl implements IMailService {


        @Autowired
        private JavaMailSender javaMailSender;

        @Override
        public void sendEmail(String from, String to, String subject, String text) {
            SimpleMailMessage message = new SimpleMailMessage();
            message.setFrom(from);
            message.setTo(to);
            message.setSubject(subject);
            message.setText(text);
            javaMailSender.send(message);
        }

}
